<?php

class Bootstrap {

    function __construct() {

        Session::init();
        $fnc= null;
        if(isset($_GET['fnc']))
        $fnc = $_GET['fnc'];
        //$func = explode('/', $func);


        //do log in
        if($fnc === null){
            require 'controllers/index.php';
            $controller = new Index();
            //hier tut login eigentlich
            $controller->index();
            return false;
        }

        $fnc = rtrim($fnc, '/');
        $file = 'controllers/' . $fnc . '.php';
        if (file_exists($file)) {
            require $file;
        } else {
            require 'controllers/error.php';
            $controller = new Error();
            $controller->index();
            return false;
        }

        //ohne login stop
        $controller = new $fnc;
        $controller->index();

        /*
        if (isset($func)) {
            $controller->{$url[1]}($func[2]);
        } else {
            if (isset($func[1])) {
                $controller->{$url[1]}();
            }
        }
         
        */
    }

}

?>
